import Ember from 'ember';
import BaseBusiness from '../base-business';
import Pagination from '../pagination';

export default BaseBusiness.extend(Pagination, {
  global_dataLoader: Ember.inject.service('data-loader'),
  model(){
    return{};
  },
  setupController(controller, model){
    this._super(controller, model);
    this.store.query('conf',{}).then(function(confList){
      let drugConf = confList.findBy("code","drugDay");
      drugConf.set('choosed',false);
      controller.set('drugConf',drugConf);
    });
    var params=this.pagiParamsSet();
    params.sort = {createDateTime:'asc'};
    var reportList=this.findPaged('customerdrugreport',params,function(reportList){
    });
    controller.set("reportList", reportList);
    console.log("reportList:",reportList);
    // this.store.query('customerdrugreport',{}).then(function(reportList){
    //   controller.set('reportList',reportList);
    // });
    // this.store.query('conf',{}).then(function(confList){
    //   let list = new Ember.A();
    //   confList.forEach(function(conf){
    //     switch (conf.get('code')) {
    //       case 'drugDay':
    //         conf.set('name','缺药提醒时间');
    //         conf.set('unit','天');
    //         conf.set('choosed',false);
    //         list.pushObject(conf);
    //         break;
    //       default:
    //     }
    //   });
    //   controller.set('confList',list);
    // });
  }
});
